
class Money implements Cloneable{
    public double money=12.25;

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
class Student1 implements Cloneable {
    public String name="张三";
    public Money  m=new Money();

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                '}';
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
public class Test2 {
    public static void main(String[] args)  throws CloneNotSupportedException  {
        Student1 student1=new Student1();
        Student1 student2=(Student1)student1.clone();
        student2.m=(Money)student1.m.clone();
        System.out.println(student1.toString());
        System.out.println(student2.toString());
        System.out.println(student1.m.money);
        System.out.println(student2.m.money);
        student2.m.money=99.0;
        System.out.println(student1.m.money);
        System.out.println(student2.m.money);
        System.out.println(new Student());
    }


}